package transport


type Transport interface {
	Init(...Option) error
	Dial(addr string, opts ...DialOption) (Client, error)
	Listen(addr string, opts ...ListenOption) (Listener, error)
	String() string
}

//数据结束符
var EOF byte =0x40

type Message struct {
	Header map[string]string
}
func NewMessage()*Message{
	return &Message{
		Header:make(map[string]string),
	}
}

type Socket interface {
	Recv(*Message) error
	Send(*Message) error
	Close() error
}

type Client interface {
	Socket
}

type Listener interface {
	Addr() string
	Close() error
	Accept(func(Socket)) error
}